package cn.steam.foo.model;

import lombok.Data;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author zhang jintao on 2022/05/15
 **/
@Data
public class TaskResult {

    private String taskId;

    private int total;

    private List<String> failedList = Collections.synchronizedList(new ArrayList<>());

    private AtomicInteger success = new AtomicInteger(0);

    private AtomicInteger failed = new AtomicInteger(0);

    public void success() {
        this.success.incrementAndGet();
    }

    public void failed() {
        this.failed.incrementAndGet();
    }

    @Override
    public String toString() {
        return "TaskVO{" +
                "success=" + success.intValue() +
                ", failed=" + failed.intValue() +
                '}';
    }
}
